import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;

import com.alibaba.fastjson2.JSONObject;
import com.muicc.pdf.pdfparser;

public class testpdf {
    public static void test(String[] args)throws Exception {
        //旋转pdf 90度
        File f18 = new File("//media/muicc/Share/work/testpdf/YP_250408001.pdf");
      //  File f18 = new File("//media/muicc/Share/work/testpdf/555.pdf");
        InputStream is18=new FileInputStream(f18);
        ByteArrayOutputStream outstream18=pdfparser.rotatePdf(is18);
        FileOutputStream fos18=new FileOutputStream("//media/muicc/Share/work/testpdf/999.pdf");
        fos18.write(outstream18.toByteArray());
        fos18.close();

        // //合并4个pdf
        // File f1 = new File("//media/muicc/Share/work/testpdf/111.pdf");
        // InputStream is1=new FileInputStream(f1);
        // File f2= new File("//media/muicc/Share/work/testpdf/222.pdf");
        // InputStream is2=new FileInputStream(f2);
        // File f3= new File("//media/muicc/Share/work/testpdf/555.pdf");
        // InputStream is3=new FileInputStream(f3);
        // File f18 = new File("//media/muicc/Share/work/testpdf/YP_250408001.pdf");
        // InputStream is18=new FileInputStream(f18);
        // ByteArrayOutputStream outstream=pdfparser.mergePdf(is1,is2,is3,is18);
        // FileOutputStream fos=new FileOutputStream("//media/muicc/Share/work/testpdf/333.pdf");
        // fos.write(outstream.toByteArray());
        // fos.close();
        // is1.close();
        // is2.close();
        // is3.close();
        // is18.close();
        // //自己生成pdf,简单实现了实线和文字。可以设置线条粗细，字体、字号、对齐。
        // //fontsize:字号，fontfamily:字体，align:1.居中 2.右对齐。left/top/width确定了文字输出的矩形范围，这样才能计算对齐方式。
        // String me="{";
        // me+="\"lines\":[{";
        // me+="\"left\":50,\"top\":700,\"right\":300,\"bottom\":700,\"linewidth\":5";
        // me+="}],";
        // me+="\"texts\":[{";
        // me+="\"left\":60,\"top\":60,\"fontsize\":19,\"width\":250,\"align\":2,\"text\":\"郝芊芊\"";
        // me+="}]";
        // me+="}";
        // JSONObject obj=JSONObject.parseObject(me);
        // ByteArrayOutputStream outstream2=pdfparser.writePdf(obj);
        // FileOutputStream fos2=new FileOutputStream("//media/muicc/Share/work/testpdf/666.pdf");
        // fos2.write(outstream2.toByteArray());
        // fos2.close();
        // outstream2.close();
    }
}
